package cn.arnold.offer.shence.test2;

import java.util.HashSet;
import java.util.Scanner;

/**
 * @Author Arnold
 * @Desc TODO
 **/
public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String A = scanner.nextLine();
        String B = scanner.nextLine();
        boolean res = false;
        int sum = 0, count = 0, temp = 0;
        HashSet<Character> set = new HashSet<>(26);
        for (int i = 0; i < A.length(); i++) {
            set.add(A.charAt(i));
            temp = A.charAt(i) - B.charAt(i);
            sum += temp;
            if (temp != 0) {
                count++;
            }
        }
        res = sum == 0 && (count == 2 || count == 0 && set.size() < A.length());
        System.out.println(res);
    }
}
